<!DOCTYPE html>
<html>
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  
  <title>SqlServer代码片段 | gdme1320 的笔记</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta name="description" content="Table of Contents   SQL Code snippets for MSSQL  修改自增列的值 判断数据库是否存在 判断要创建的表名是否存在 判断要创建临时表是否存在 判断要创建的存储过程名是否存在 判断要创建的视图名是否存在 判断要创建的函数名是否存在 Selecting Top N Records per Group       SQL Code snippets fo">
<meta property="og:type" content="article">
<meta property="og:title" content="SqlServer代码片段">
<meta property="og:url" content="http://gdme1320.gitee.com/mssql/snippets/index.html">
<meta property="og:site_name" content="gdme1320 的笔记">
<meta property="og:description" content="Table of Contents   SQL Code snippets for MSSQL  修改自增列的值 判断数据库是否存在 判断要创建的表名是否存在 判断要创建临时表是否存在 判断要创建的存储过程名是否存在 判断要创建的视图名是否存在 判断要创建的函数名是否存在 Selecting Top N Records per Group       SQL Code snippets fo">
<meta property="og:locale" content="default">
<meta property="og:updated_time" content="2022-03-23T09:59:03.626Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="SqlServer代码片段">
<meta name="twitter:description" content="Table of Contents   SQL Code snippets for MSSQL  修改自增列的值 判断数据库是否存在 判断要创建的表名是否存在 判断要创建临时表是否存在 判断要创建的存储过程名是否存在 判断要创建的视图名是否存在 判断要创建的函数名是否存在 Selecting Top N Records per Group       SQL Code snippets fo">
  
    <link rel="alternate" href="/atom.xml" title="gdme1320 的笔记" type="application/atom+xml">
  
  
  
    <link href="//fonts.googleapis.com/css?family=Source+Code+Pro" rel="stylesheet" type="text/css">
  

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" integrity="sha384-XdYbMnZ/QjLh6iI4ogqCTaIjrFk87ip+ekIjefZch0Y+PvJ8CDYtEs1ipDmPorQ+" crossorigin="anonymous">

  <link rel="stylesheet" href="/css/styles.css">
  <link rel="stylesheet" href="/css/docs.min.css">
  

</head>
</html>
<body>
  <nav class="navbar navbar-inverse">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#main-menu-navbar" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="main-menu-navbar">
      <ul class="nav navbar-nav">
        
          <li><a class href="/index.html">Home</a></li>
        
          <li><a class href="/archives/">Archives</a></li>
        
      </ul>

      <!--
      <ul class="nav navbar-nav navbar-right">
        
          <li><a href="/atom.xml" title="RSS Feed"><i class="fa fa-rss"></i></a></li>
        
      </ul>
      -->
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

  <div class="container bs-docs-container">
  
    <div class="row">
        <div class="col-sm-8 blog-main">
          <article id="post-mssql/snippets" class="article article-type-post" itemscope itemprop="blogPost">

  <header class="article-header">
    
  
    <h1 class="article-title" itemprop="name">
      SqlServer代码片段
    </h1>
  


  </header>

  <div class="article-meta">
    <div class="article-datetime">
  <a href="/mssql/snippets/" class="article-date"><time datetime="1970-01-01T00:00:02.016Z" itemprop="datePublished">1970-01-01</time></a>
</div>

    
    
  <div class="article-category">
    <a class="article-category-link" href="/categories/mssql/">mssql</a>
  </div>


  </div>
  <div class="article-inner">

    <div class="article-entry" itemprop="articleBody">
      
        
<div id="content">
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org15557ea">SQL Code snippets for MSSQL</a>
<ul>
<li><a href="#org450dde5">修改自增列的值</a></li>
<li><a href="#org8e1da8a">判断数据库是否存在</a></li>
<li><a href="#org50422d3">判断要创建的表名是否存在</a></li>
<li><a href="#org87a242d">判断要创建临时表是否存在</a></li>
<li><a href="#org1515bba">判断要创建的存储过程名是否存在</a></li>
<li><a href="#orgb997787">判断要创建的视图名是否存在</a></li>
<li><a href="#orgc630d7e">判断要创建的函数名是否存在</a></li>
<li><a href="#org672518b">Selecting Top N Records per Group</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="outline-2" id="outline-container-org15557ea">
<h2 id="org15557ea">SQL Code snippets for MSSQL</h2>
<div class="outline-text-2" id="text-org15557ea">
</div>
<div class="outline-3" id="outline-container-org450dde5">
<h3 id="org450dde5">修改自增列的值</h3>
<div class="outline-text-3" id="text-org450dde5">
<blockquote>
<p>
<a href="https://stackoverflow.com/questions/19155775/how-to-update-identity-column-in-sql-server" target="_blank" rel="noopener">https://stackoverflow.com/questions/19155775/how-to-update-identity-column-in-sql-server</a>
</p>
</blockquote>
<p>
打开自增列插入，然后插入新的数据替换原来的数据
</p>
<div class="org-src-container">
<pre class="src src-sql"><span style="font-weight: bold; font-style: italic;">-- Set Identity insert on so that value can be inserted into this column</span>
<span style="font-weight: bold;">SET</span> IDENTITY_INSERT YourTable <span style="font-weight: bold;">ON</span>
<span style="font-weight: bold;">GO</span>
<span style="font-weight: bold; font-style: italic;">-- Insert the record which you want to update with new value in identity column</span>
<span style="font-weight: bold;">INSERT</span> <span style="font-weight: bold;">INTO</span> YourTable(IdentityCol, otherCol) <span style="font-weight: bold;">VALUES</span>(13,<span style="font-style: italic;">'myValue'</span>)
<span style="font-weight: bold;">GO</span>
<span style="font-weight: bold; font-style: italic;">-- Delete the old row of which you have inserted a copy (above) (make sure about FK's)</span>
<span style="font-weight: bold;">DELETE</span> <span style="font-weight: bold;">FROM</span> YourTable <span style="font-weight: bold;">WHERE</span> ID=3
<span style="font-weight: bold;">GO</span>
<span style="font-weight: bold; font-style: italic;">--Now set the idenetity_insert OFF to back to prevoius track</span>
<span style="font-weight: bold;">SET</span> IDENTITY_INSERT YourTable <span style="font-weight: bold;">OFF</span>
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-org8e1da8a">
<h3 id="org8e1da8a">判断数据库是否存在</h3>
<div class="outline-text-3" id="text-org8e1da8a">
<div class="org-src-container">
<pre class="src src-sql">if <span style="font-weight: bold;">exists</span>(<span style="font-weight: bold;">select</span> * <span style="font-weight: bold;">from</span> master..sysdatabases <span style="font-weight: bold;">where</span> <span style="font-weight: bold;">name</span>=N<span style="font-style: italic;">'库名'</span>) 
print <span style="font-style: italic;">'exists'</span> 
<span style="font-weight: bold;">else</span> 
print <span style="font-style: italic;">'not exists'</span> 
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-org50422d3">
<h3 id="org50422d3">判断要创建的表名是否存在</h3>
<div class="outline-text-3" id="text-org50422d3">
<div class="org-src-container">
<pre class="src src-sql">if <span style="font-weight: bold;">exists</span> (<span style="font-weight: bold;">select</span> * <span style="font-weight: bold;">from</span> dbo.sysobjects <span style="font-weight: bold;">where</span> id = object_id(N<span style="font-style: italic;">'[dbo].[表名]'</span>) <span style="font-weight: bold;">and</span> OBJECTPROPERTY(id, N<span style="font-style: italic;">'IsUserTable'</span>) = 1) 
<span style="font-weight: bold;">drop</span> <span style="font-weight: bold;">table</span> [dbo].[表名] 
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-org87a242d">
<h3 id="org87a242d">判断要创建临时表是否存在</h3>
<div class="outline-text-3" id="text-org87a242d">
<div class="org-src-container">
<pre class="src src-sql">If Object_Id(<span style="font-style: italic;">'Tempdb.dbo.#Test'</span>) <span style="font-weight: bold;">Is</span> <span style="font-weight: bold;">Not</span> <span style="font-weight: bold;">Null</span> 
<span style="font-weight: bold;">Begin</span> 
print <span style="font-style: italic;">'存在'</span> 
<span style="font-weight: bold;">End</span> 
<span style="font-weight: bold;">Else</span> 
<span style="font-weight: bold;">Begin</span> 
print <span style="font-style: italic;">'不存在'</span> 
<span style="font-weight: bold;">End</span> 
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-org1515bba">
<h3 id="org1515bba">判断要创建的存储过程名是否存在</h3>
<div class="outline-text-3" id="text-org1515bba">
<div class="org-src-container">
<pre class="src src-sql">if <span style="font-weight: bold;">exists</span> (<span style="font-weight: bold;">select</span> * <span style="font-weight: bold;">from</span> dbo.sysobjects <span style="font-weight: bold;">where</span> id = object_id(N<span style="font-style: italic;">'[dbo].[存储过程名]'</span>) <span style="font-weight: bold;">and</span> OBJECTPROPERTY(id, N<span style="font-style: italic;">'IsProcedure'</span>) = 1) 
<span style="font-weight: bold;">drop</span> <span style="font-weight: bold;">procedure</span> [dbo].[存储过程名] <span style="font-weight: bold; font-style: italic;">-- 删除存储过程 </span>
<span style="font-weight: bold;">GO</span> 
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-orgb997787">
<h3 id="orgb997787">判断要创建的视图名是否存在</h3>
<div class="outline-text-3" id="text-orgb997787">
<div class="org-src-container">
<pre class="src src-sql">if <span style="font-weight: bold;">exists</span> (<span style="font-weight: bold;">select</span> * <span style="font-weight: bold;">from</span> dbo.sysobjects <span style="font-weight: bold;">where</span> id = object_id(N<span style="font-style: italic;">'[dbo].[视图名]'</span>) <span style="font-weight: bold;">and</span> OBJECTPROPERTY(id, N<span style="font-style: italic;">'IsView'</span>) = 1) 
<span style="font-weight: bold;">drop</span> <span style="font-weight: bold;">view</span> [dbo].[视图名] <span style="font-weight: bold; font-style: italic;">-- 删除视图 </span>
<span style="font-weight: bold;">GO</span> 
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-orgc630d7e">
<h3 id="orgc630d7e">判断要创建的函数名是否存在</h3>
<div class="outline-text-3" id="text-orgc630d7e">
<div class="org-src-container">
<pre class="src src-sql">if <span style="font-weight: bold;">exists</span> (<span style="font-weight: bold;">select</span> * <span style="font-weight: bold;">from</span> dbo.sysobjects <span style="font-weight: bold;">where</span> id = object_id(N<span style="font-style: italic;">'[dbo].[函数名]'</span>) <span style="font-weight: bold;">and</span> xtype <span style="font-weight: bold;">in</span> (N<span style="font-style: italic;">'FN'</span>, N<span style="font-style: italic;">'IF'</span>, N<span style="font-style: italic;">'TF'</span>)) 
<span style="font-weight: bold; font-style: italic;">-- 删除函数 </span>
<span style="font-weight: bold;">drop</span> <span style="font-weight: bold;">function</span> [dbo].[函数名] 
<span style="font-weight: bold;">GO</span> 

if col_length(<span style="font-style: italic;">'表名'</span>, <span style="font-style: italic;">'列名'</span>) <span style="font-weight: bold;">is</span> <span style="font-weight: bold;">null</span> 
print <span style="font-style: italic;">'不存在'</span> 

<span style="font-weight: bold;">select</span> 1 <span style="font-weight: bold;">from</span> sysobjects <span style="font-weight: bold;">where</span> id <span style="font-weight: bold;">in</span> (<span style="font-weight: bold;">select</span> id <span style="font-weight: bold;">from</span> syscolumns <span style="font-weight: bold;">where</span> <span style="font-weight: bold;">name</span>=<span style="font-style: italic;">'列名'</span>) <span style="font-weight: bold;">and</span> <span style="font-weight: bold;">name</span>=<span style="font-style: italic;">'表名'</span> 
</pre>
</div>
</div>
</div>
<div class="outline-3" id="outline-container-org672518b">
<h3 id="org672518b">Selecting Top N Records per Group</h3>
<div class="outline-text-3" id="text-org672518b">
<p>
数据分组之后，各组按照某种顺序排列，然后选择每组的前N条。
</p>
<blockquote>
<p>
<a href="http://sqlserverplanet.com/tsql/selecting-top-n-records-per-group" target="_blank" rel="noopener">Selecting Top N Records per Group</a>
<a href="http://sqlserverplanet.com/ddl/varchar-vs-char" target="_blank" rel="noopener">Pre: Varchar Vs Char</a>
<a href="http://sqlserverplanet.com/optimization/using-union-instead-of-or" target="_blank" rel="noopener">Next: Using Union Instead of OR</a>
</p>
</blockquote>
<p>
When you have multiple rows for let’s say a productID, there will probably be times when you need to select the top n subset of each those productid’s based upon a sort criteria. This is a relatively common TSQL need and there are a couple different methods to do this.
</p>
<p>
First let’s create some dummy data.
</p>
<div class="org-src-container">
<pre class="src src-sql"><span style="font-weight: bold;">CREATE</span> <span style="font-weight: bold;">TABLE</span> [#productzabub](
        [SalesOrderID] [<span style="font-weight: bold; text-decoration: underline;">INT</span>] <span style="font-weight: bold;">NOT</span> <span style="font-weight: bold;">NULL</span>,
        [ProductID] [<span style="font-weight: bold; text-decoration: underline;">INT</span>] <span style="font-weight: bold;">NOT</span> <span style="font-weight: bold;">NULL</span>
    )
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71782, 707)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71783, 707)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71784, 707)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71782, 708)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71783, 708)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71784, 708)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71782, 711)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71783, 711)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71784, 711)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71782, 712)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71783, 712)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71784, 712)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71782, 714)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71783, 714)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71784, 714)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71782, 715)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71783, 715)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71784, 715)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71783, 716)
    <span style="font-weight: bold;">INSERT</span> [#productzabub] ([SalesOrderID], [ProductID]) <span style="font-weight: bold;">VALUES</span> (71784, 716)
</pre>
</div>
<p>
Now that we have our data created, let’s select the top 2 rows for each productid based upon the earliest salesorderid. This salesorderid could actually represent any sequential column in the table, be it a date, or a primary key.
</p>
<p>
The first method we’ll use is to select using the new window function ROW_NUMBER() introduced in SQL 2005. What we’re doing here is simply creating a numbering system that enumerates each instance of the productid ordered by the salesorderid. We then do another select on this query.
</p>
<div class="org-src-container">
<pre class="src src-sql"><span style="font-weight: bold;">SELECT</span> TOP 20
        t.SalesOrderID,
        t.ProductID
    <span style="font-weight: bold;">FROM</span> (
        <span style="font-weight: bold;">SELECT</span> 
            sod.SalesOrderID,
            sod.ProductID,
            rowid = ROW_NUMBER() OVER (PARTITION <span style="font-weight: bold;">BY</span> ProductID <span style="font-weight: bold;">ORDER</span> <span style="font-weight: bold;">BY</span> SalesOrderID)
        <span style="font-weight: bold;">FROM</span> #productzabub sod
    ) t
    <span style="font-weight: bold;">WHERE</span> rowid &lt;= 2
</pre>
</div>
<p>
The next method we’ll use is compatible with all versions of SQL. Here we are doing a self-join using a correlated subquery. Meaning we are correlating the productid from the outer query, with the productid from the inner query. We then select the top two salesorderid’s from each instance, constraining our outer result set to the top 2 rows for product.
</p>
<pre class="example">
SELECT 
	sod.SalesOrderID,
	sod.ProductID
    FROM #productzabub sod
    WHERE SalesOrderID IN
    (
	SELECT TOP 2 SalesOrderID
	FROM #productzabub
	WHERE ProductID = sod.ProductID
	ORDER BY SalesOrderID
    )
</pre>
<p>
That’s pretty much it. Personally I prefer using the window functions when I can, they typically have a speed advantage over other methods because they don’t join anything, just sort by doing an order by internally. You may see other methods using a CTE. This is not actually another method, it’s simply the same as the windowed function execution-wise.
</p>
</div>
</div>
</div>
</div>
<div class="status" id="postamble">
<p class="date">Date: 2016</p>
<p class="author">Author: gdme1320</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer" target="_blank" rel="noopener">Validate</a></p>
</div>

      
    </div>

    
      

    

    <footer class="article-footer">
      <a data-url="http://gdme1320.gitee.com/mssql/snippets/" data-id="cl13eo7k0008jhjv4orknezt0" class="article-share-link">
        <i class="fa fa-share"></i> Share
      </a>
      
      

    </footer>
  </div>
  
    
<ul id="article-nav" class="nav nav-pills nav-justified">
  
  <li role="presentation">
    <a href="/mssql/transaction-isolation-level/" id="article-nav-older" class="article-nav-link-wrap">
      <i class="fa fa-chevron-left pull-left"></i>
      <span class="article-nav-link-title">SqlServer事务隔离等级</span>
    </a>
  </li>
  
  
  <li role="presentation">
    <a href="/mssql/hierarchyid-datatype/" id="article-nav-newer" class="article-nav-link-wrap">
      <span class="article-nav-link-title">SqlServer中的HierarchyId数据类型</span>
      <i class="fa fa-chevron-right pull-right"></i>
    </a>
  </li>
  
</ul>


  
</article>




        </div>
        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
          
  
  <div class="sidebar-module">
    <h4>Categories</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/apps/">apps</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/architecture/">architecture</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/">devops</a><span class="sidebar-module-list-count">10</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/kubectl/">kubectl</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/devops/kubernetes/">kubernetes</a><span class="sidebar-module-list-count">3</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/dotnet/">dotnet</a><span class="sidebar-module-list-count">3</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/dotnet/entityframework/">entityframework</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/elasticsearch/">elasticsearch</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/emacs/">emacs</a><span class="sidebar-module-list-count">4</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/emacs/org-mode/">org-mode</a><span class="sidebar-module-list-count">3</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/git/">git</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/graphql/">graphql</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/groovy/">groovy</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/">java</a><span class="sidebar-module-list-count">52</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/concurrent/">concurrent</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/jackson/">jackson</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/shiro/">shiro</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring/">spring</a><span class="sidebar-module-list-count">11</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-amqp/">spring-amqp</a><span class="sidebar-module-list-count">5</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-amqp/spring-jpa/">spring-jpa</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-jpa/">spring-jpa</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/spring-security/">spring-security</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/thymeleaf/">thymeleaf</a><span class="sidebar-module-list-count">2</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/java/thymeleaf/maven/">maven</a><span class="sidebar-module-list-count">1</span></li></ul></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/jenkins/">jenkins</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/journal/">journal</a><span class="sidebar-module-list-count">7</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/js/">js</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/">linux</a><span class="sidebar-module-list-count">35</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kde/">kde</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kross/">kross</a><span class="sidebar-module-list-count">3</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/kross/ktorrent-scripts/">ktorrent-scripts</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/shell/">shell</a><span class="sidebar-module-list-count">6</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/linux/tcp/">tcp</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/lisp/">lisp</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mongodb/">mongodb</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mssql/">mssql</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/mysql/">mysql</a><span class="sidebar-module-list-count">12</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/nginx/">nginx</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/node/">node</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/postgresql/">postgresql</a><span class="sidebar-module-list-count">2</span><ul class="sidebar-module-list-child"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/postgresql/client/">client</a><span class="sidebar-module-list-count">1</span></li></ul></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/python/">python</a><span class="sidebar-module-list-count">19</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/regex/">regex</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/rfc/">rfc</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/vim/">vim</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/categories/windows/">windows</a><span class="sidebar-module-list-count">7</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Tags</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/ReentrantLock/">ReentrantLock</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/nohup/">nohup</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/tags/pandoc/">pandoc</a><span class="sidebar-module-list-count">1</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Tag Cloud</h4>
    <p class="tagcloud">
      <a href="/tags/ReentrantLock/" style="font-size: 10px;">ReentrantLock</a> <a href="/tags/nohup/" style="font-size: 10px;">nohup</a> <a href="/tags/pandoc/" style="font-size: 10px;">pandoc</a>
    </p>
  </div>


  
  <div class="sidebar-module">
    <h4>Archives</h4>
    <ul class="sidebar-module-list"><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2919/06/">June 2919</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2022/03/">March 2022</a><span class="sidebar-module-list-count">58</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2022/01/">January 2022</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/11/">November 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/10/">October 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/04/">April 2021</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/03/">March 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/02/">February 2021</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2021/01/">January 2021</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/12/">December 2020</a><span class="sidebar-module-list-count">2</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/11/">November 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/10/">October 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/09/">September 2020</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/07/">July 2020</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/06/">June 2020</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/04/">April 2020</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/03/">March 2020</a><span class="sidebar-module-list-count">8</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/02/">February 2020</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2020/01/">January 2020</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/12/">December 2019</a><span class="sidebar-module-list-count">7</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/11/">November 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/10/">October 2019</a><span class="sidebar-module-list-count">11</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/09/">September 2019</a><span class="sidebar-module-list-count">6</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/08/">August 2019</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/07/">July 2019</a><span class="sidebar-module-list-count">10</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/06/">June 2019</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/05/">May 2019</a><span class="sidebar-module-list-count">3</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/04/">April 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/03/">March 2019</a><span class="sidebar-module-list-count">8</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/02/">February 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2019/01/">January 2019</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/11/">November 2018</a><span class="sidebar-module-list-count">4</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/10/">October 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/08/">August 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/07/">July 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/06/">June 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2018/03/">March 2018</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/07/">July 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/06/">June 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2017/04/">April 2017</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/2015/05/">May 2015</a><span class="sidebar-module-list-count">1</span></li><li class="sidebar-module-list-item"><a class="sidebar-module-list-link" href="/archives/1970/01/">January 1970</a><span class="sidebar-module-list-count">9</span></li></ul>
  </div>



  
  <div class="sidebar-module">
    <h4>Recents</h4>
    <ul class="sidebar-module-list">
      
        <li>
          <a href="/java/acessing-generic-types-at-runtime/">获取泛型类型</a>
        </li>
      
        <li>
          <a href="/linux/shell/bash_cgi/">Script for Shell Parsing Parameters</a>
        </li>
      
        <li>
          <a href="/linux/shell/shell-script/">Shell Script Getting Start</a>
        </li>
      
        <li>
          <a href="/linux/tcp/network-tcp-performance-turning-with-sysctl/">【翻译】Sysctl调节Linux网络性能</a>
        </li>
      
        <li>
          <a href="/java/concurrent/aqs-src/">AQS源码笔记</a>
        </li>
      
    </ul>
  </div>



        </div>
    </div>
  </div>
  <footer class="blog-footer">
  <div class="container">
    <div id="footer-info" class="inner">
      &copy; 2022 gdme1320<br>
      Powered by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer>

  

<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js" integrity="sha384-8gBf6Y4YYq7Jx97PIqmTwLPin4hxIzQw5aDmUg/DDhul9fFpbbLcLh3nTIIDJKhx" crossorigin="anonymous"></script> -->

<script src="/js/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>



<script src="/js/script.js"></script>

</body>
</html>
